package com.meowcook.mapper;

import com.meowcook.pojo.dto.FollowDTO;
import com.meowcook.pojo.po.Follow;
import com.meowcook.pojo.vo.FollowVO;
import com.meowcook.pojo.vo.IdolVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 28792
 * Date: 2025-10-29
 * Time: 14:34
 */
@Mapper(componentModel = "spring")
public interface FollowPojoMapper {

    @Mapping(source = "follow.id", target = "id")
    @Mapping(source = "follow.fanId", target = "fanId")
    @Mapping(source = "follow.idolId", target = "idolId")
    @Mapping(source = "follow.isBlocked", target = "isBlocked")
    FollowVO toVO(Follow follow);

    @Mapping(source = "id", target = "id")
    @Mapping(source = "fanId", target = "fanId")
    @Mapping(source = "idolId", target = "idolId")
    @Mapping(source = "isBlocked", target = "isBlocked")
    Follow toPO(FollowDTO followDTO);

    @Mapping(source = "id", target = "id")
    @Mapping(source = "isBlocked", target = "isBlocked")
    @Mapping(source = "idol.id", target = "idol.id")
    @Mapping(source = "idol.nickname", target = "idol.nickname")
    @Mapping(source = "idol.avatarUrl", target = "idol.avatarUrl")
    @Mapping(source = "idol.isAdmin", target = "idol.isAdmin")
    @Mapping(source = "idol.bio", target = "idol.bio")
    @Mapping(source = "idol.recipeCount", target = "idol.recipeCount")
    @Mapping(source = "idol.fansCount", target = "idol.fansCount")
    List<IdolVO> toIdolVO(List<Follow> follow);
}
